#include<iostream>

using namespace std;
int n;
const int N = 110;
int a[N];
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int k; cin >> k;
    for (int i = 1; i <= k; i++) 
    {
        bool flag = false;
        int win = 0;
        for (int i = 1; i <= n; i++)
        {
            int x; cin >> x;
            if (a[i] == x) win++;
            if (a[i] != x && x) flag = true;
        }
        if (flag) cout << "Ai Ya" << endl;
        else if (win)cout << "Da Jiang!!!" << endl;
        else cout << "Ai Ya" << endl;
    }
    return 0;
}